<?php

// @formatter:off
/**
 * @file index.php
 * @author Alejandro Dario Simi
 * @date $Date: 2014-05-04 01:33:52 +0000 (Sun, 04 May 2014) $
 *
 * $Id: index.php 111 2014-05-04 01:33:52Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/index.php $
 */
// @formatter:on

require_once __DIR__."/config/defines.php";

$isMobile = (isset($_COOKIE[WC_COOKIE_MOBILE_MODE]) && $_COOKIE[WC_COOKIE_MOBILE_MODE] == "ON");

define($isMobile ? "__MOBILE__" : "__INDEX__", true);

require_once __DIR__."/config/config.php";

if(defined("WC_NOT_INSTALLED")) {
	require_once "{$wcPaths["install-directory"]}/not-installed.php";
} else {
	$timer = WCTimer::Instance();
	$timer->startGlobal();

	require_once "{$wcPaths["includes-directory"]}/dynamic.conf.php";
	require_once "{$wcPaths["includes-directory"]}/tools.php";

	$cacheId = $isMobile ? "MOBILE" : "INDEX";
	WCHoldersBus::Instance()->restrictGroup($wcGroup);

	$viewManager = WCViewManager::I();
	$layout = $viewManager->loadLayoutController();
	$action = $viewManager->loadActionController();
									
	echo $viewManager->buildOutput($action, $layout);

	$timer->saveGlobal($cacheId);
}
